package bairui.international.console.web.controller.index.module;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lianjing.sh.model.uml.model.status.State_UpDown;
import com.lianjing.sh.spring.web.controller.base.action.Action;
import com.lianjing.sh.spring.web.controller.enhance.output.FomatOutput;
import com.sh_lianjing.util.Util_BeanCopyByDeclaredProperties;

import bairui.international.model.domain.jpa.TB_IndexModule;
import bairui.international.service.Service_IndexModule;

/**
 *
 * 添加
 *
 * @generated
 * 
 * @see STest_C_Index_Module_Add_Add 测试
 *
 */
@Controller
public class C_Index_Module_Add_Add
 extends SC_Index_Module_Add_Add 
{
	
	@Autowired private Service_IndexModule service_IndexModule;
	
	/**
	 * 添加
	 */
	@Action(Add.class)
	@PostMapping(Add.RequestMappingValue)
	public @FomatOutput @ResponseBody Object add(
		@Valid Add.InputModel input
	) throws Exception {
		TB_IndexModule bean = new TB_IndexModule();
		TB_IndexModule saveBean = Util_BeanCopyByDeclaredProperties.copyProperties(input, bean);
		saveBean.setState(State_UpDown.t_create().to());
		// 保存数据
		service_IndexModule.save(
				saveBean
			);
		//
		return null;
	}
	

}
